# -*- encoding: utf-8 -*-

"""
每次只能爬 1 或 2 级，求 n 级楼梯有多少种爬法
"""


def climb_stairs(n: int) -> int:
    """
    :param n: 多少级楼梯
    :return:  dp：下标表示多少级楼梯有多少种走法
    """
    assert isinstance(n, int) and n > 0, 'n必须大于0'
    if n == 1:
        return 1
    dp = [0] * (n + 1)
    dp[0] = dp[1] = 1
    for i in range(2, n+1):
        dp[i] = dp[i - 1] + dp[i - 2]
    return dp


print(climb_stairs(3))
print(climb_stairs(1))
print(climb_stairs(7))
# climb_stairs(-7)


